(a) The output from names includes the following:
[1] "sdev" "loadings" "center" "scores"
Describe each of these components in mathematical terms. To answer this part of the question, you can print and plot the components to see what they contain and use R's help for further information.
(b) What are the first two eigenvalues of the covariance matrix?
(c) What is the eigenvector corresponding to the largest eigenvalue?
(d) Suppose you wish to “explain” at least 95% of the variation in the changes in the yield curves. Then how many principal components should you use?
SOLUTION
Part (a): The variable sdev holds the standard deviations of each principal components, these are also the square root of the eigenvalues of the covariance matrix. The variable loadings hold the eigenvectors of the covariance matrix. The variable center hold the means that were subtracted in each feature dimension in computing the covariance matrix. The variable scores holds a matrix of each vector variable projected into all its principle components. We can check that this is so by comparing the two outputs
t(as.matrix(pca_del$loadings[,])) %*% t( delta_yield[1,] – pca_del$center )
2
Comp.1 0.1905643953
Comp.2 0.0375662026
Comp.3 0.0438591813
Comp.4 – 0.0179855611
Comp.5 0.0002473111
Comp.6 0.0002924385
Comp.7 0.0101975886
Comp.8 – 0.0093768514
Comp.9 – 0.0036798653
Comp.10 0.0004287954
Comp.11 – 0.0005602180
with
pca_del$scores[1,]
Unlock the complete assignment
You are viewing the free preview. Purchase this assignment once to reveal the complete resource.
Secure checkout is completed by Stripe.